
import Main from '@/views/main/main.vue'
import IFrame from '@/components/iframe/iframe.vue'
import ParentView from '@/components/parent-view/parent-view.vue'

/**
 * meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  auth: (system:role:ui) 可访问该页面的权限
 * }
 */


const Login = {
    path: '/login',
    name: 'login',
    meta: {
        hideInMenu: true
    },
    component: () => import('@/views/login/login.vue')
}

const Home = {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
        hideInMenu: true
    },
    children: [
        {
            path: '/home',
            name: 'home',
            meta: {
                title: '首页',
                hideInMenu: true
            },
            component: () => import('@/views/dashboard/dashboard.vue')
        }
    ]
}

const Profile = {
    path: '/profile',
    name: '_profile',
    meta: {
        title: '个人信息',
        hideInMenu: true
    },
    component: Main,
    children: [
        {
            path: '/profile',
            name: 'profile',
            meta: {
                title: '我的信息',
                hideInMenu: false
            },
            component: () => import('@/views/profile/index.vue')
        }
    ]
}


const Biz = [
    {
        path: '/oa/hr',
        name: '_hr',
        component: Main,
        meta: {
            title: '人力资源',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: 'organization',
                name: '_organization',
                meta: {
                    title: '组织机构',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import('@/views/oa/organization/index.vue')
            },
            {
                path: 'position',
                name: '_position',
                meta: {
                    title: '岗位管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import('@/views/oa/position/index.vue')
            },
            {
                path: 'person',
                name: '_person',
                meta: {
                    title: '人事档案',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import('@/views/oa/person/index.vue'),
            },
            {
                path: 'addPerson',
                name: '_addPerson',
                meta: {
                    title: '添加员工',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () => import('@/views/oa/person/add_person.vue')
            }
        ]
    },
    {
        path: '/data/report',
        name: '_report',
        component: Main,
        meta: {
            title: '数据分析',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: 'reportUser',
                name: '_report_user',
                meta: {
                    title: '项目统计',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import('@/views/oa/report/ProjectGroupByYear.vue')
            },
            {
                path: 'reportGoods',
                name: '_report_goods',
                meta: {
                    title: '商品分析',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import('@/views/mall/report/goods/index.vue')
            }
        ]
    },
    {
        path: '/system',
        name: '_system',
        component: Main,
        meta: {
            title: '系统管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: 'menu',
                name: 'menu',
                meta: {
                    title: '菜单管理',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                component: () => import('@/views/system/menu/menu.vue')
            },
            {
                path: 'role',
                name: 'role',
                meta: {
                    title: '角色管理',
                    icon: 'el-icon-location',
                    auth: 'system:role:ui'
                },
                component: () => import('@/views/system/role/role.vue')
            },
            {
                path: 'user',
                name: 'user',
                meta: {
                    title: '用户管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import('@/views/system/user/user.vue')
            },
            {
                path: 'message',
                name: 'message',
                meta: {
                    title: '即时信息',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                component: () => import('@/views/system/message/message.vue')
            },
            {
                path: 'oss',
                name: 'oss',
                meta: {
                    title: '文件管理',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/system/oss/oss.vue')
            },
            {
                path: 'area',
                name: 'area',
                meta: {
                    title: '地区管理',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/system/area/index.vue')
            },
            {
                path: 'log',
                name: 'log',
                meta: {
                    title: '系统日志',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/system/log/log.vue')
            },
            {
                path: 'elastic-console',
                name: 'elastic-console',
                meta: {
                    title: '任务管理',
                    icon: 'el-icon-location',
                    href: 'http://elastic-job.mars.com'
                },
                component: IFrame
            },
            {
                path: 'admin_server',
                name: 'admin_server',
                meta: {
                    title: '分布式监控',
                    icon: 'el-icon-location',
                    href: 'http://admin.server.mars.com'
                },
                component: IFrame
            },
            {
                path: 'rabbitmq',
                name: 'rabbitmq',
                meta: {
                    title: '消息队列',
                    icon: 'el-icon-location',
                    href: 'http://rabbitmq.mars.com'
                },
                component: IFrame
            },
            {
                path: 'test',
                name: 'test',
                meta: {
                    title: '测试页面',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                component: () => import('@/views/test/test.vue')
            }
        ]
    },
]

const Errors = [
    {
        path: '/errors',
        component: Main,
        name: 'ErrorPages',
        meta: {
            title: '错误',
            hideInMenu: true,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: '401',
                name: '401',
                meta: {
                    title: '401',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/errors/401.vue')
            },
            {
                path: '404',
                name: '404',
                meta: {
                    title: '404',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/errors/404.vue')
            }
        ]
    },
    {
        path: '*',
        name: 'error_404',
        redirect: '/errors/404',
        meta: {
            hideInMenu: true
        }
    }
]

export default [
    Login,
    Home,
    Profile,
    ...Biz,
    ...Errors
]